# -*- coding: utf-8 -*-
import os
from sqlalchemy import create_engine
import pandas as pd

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
# 同样的套路，创建连接引擎
engine = create_engine('oracle+cx_oracle://scyjAct:scyj@120.77.215.15:55555/XE')

# with管理安全
with engine.connect() as conn, conn.begin():
    # 直接给出要查的表名，sql原生语句都不用写了
    data = pd.read_sql_table('stock_all', conn)
print(data.head())  # 查看前5个数据
